import { ThrottlerGuard } from '@nestjs/throttler';
import { Injectable } from '@nestjs/common';

@Injectable()
export class ThrottlerProxyGuard extends ThrottlerGuard {
  // canActivate(
  //   context: ExecutionContext,
  // ): boolean | Promise<boolean> | Observable<boolean> {
  //   // const request = context.switchToHttp().getRequest();
  //   return super.canActivate(context);
  // }
  // protected getTracker(req: Record<string, any>): string {
  //   return req.ips.length ? req.ips[0] : req.ip; // individualize IP extraction to meet your own needs
  // }
  getErrorMessage() {
    return Promise.resolve('请求过于频繁，请稍后再试');
  }
}
